package com.example.aircraft.prop;


import com.example.aircraft.MyApplication;
import com.example.aircraft.R;
import com.example.aircraft.aircraft.Enemy;
import com.example.aircraft.base.AbstractFlyingObject;
import com.example.aircraft.base.MusicThread;

import java.util.LinkedList;
import java.util.List;

/**
 * @author lzf
 *
 */
public abstract class AbstractProp extends AbstractFlyingObject {
    protected MusicThread musicThread;
    public AbstractProp(int locationX, int locationY, int speedX, int speedY){
        super(locationX, locationY, speedX, speedY);
        musicThread = new MusicThread(R.raw.get_supply);
    }

    /**
     * 敌机目标列表
     */
    protected  static List<Enemy> targets_e = new LinkedList<>();

    @Override
    public void forward(){
        super.forward();
        if (locationY >= MyApplication.getContext().getResources().getDisplayMetrics().heightPixels ) {
            vanish();
        }
    }
    public void registerTargets(List<Enemy> T){
        targets_e = T;
    }

    /**
     * 补给被拾取时的行为
     * 播放音频是共有行为
     */
    public void  activate(){
        if(MyApplication.isMusicOn()){
            this.musicThread.start();
        }
    }

}
